import javax.swing.*;
import javax.swing.border.Border;

import java.awt.*;

public class ResultColumn extends JPanel {
	ImageIcon result;
	JLabel holder;

	public ResultColumn(int[] values) {
		// finds the image appropriate to the result of the guess
		result = new ImageIcon("src/images/" + values[0] + "b" + values[1]
				+ "w.gif");
		holder = new JLabel(result);

		Border empty = BorderFactory.createEmptyBorder();
		Color background = new Color(189, 186, 189);

		this.setBorder(empty);
		this.setBackground(background);

		this.add(holder);
	}

	// Inserts Blank Results
	public ResultColumn() {
		// automatcially sets it to the empty result image
		result = new ImageIcon("src/images/0b0w.gif");
		holder = new JLabel(result);

		Border empty = BorderFactory.createEmptyBorder();
		Color background = new Color(189, 186, 189);

		this.setBorder(empty);
		this.setBackground(background);
		
		// adds the holder to the panel
		this.add(holder);
	}

	public void clear() {
		this.removeAll();
		this.repaint();
		result = new ImageIcon("src/images/0b0w.gif");
		holder = new JLabel(result);
		this.add(holder);
		this.validate();
	}

	// set the result to equal a particular array of values
	public void setResult(int[] values) {
		String filename = "src/images/" + values[0] + "b" + values[1] + "w.gif";
		this.removeAll();
		this.repaint();
		result = new ImageIcon(filename);
		holder = new JLabel(result);
		this.add(holder);
		this.validate();
	}
}
